<?
$path = realpath("."); 
$dir = opendir($path);

print("<html>\n");
print("<h3>Directory: $path</h3>\n");
// print the current directory in unordered list
print("<ul>\n");

while (false !== ($file = readdir($dir))) {
  $url = rawurlencode($file);
  if ($file == "..") {
    print("<li><a href=$url>[Parent]</a></li>\n");
  } elseif (
	    $file != "." &&
	    $file != "index.php" && $file != "index.php~" &&
	    $file != ".htaccess" && $file != ".htaccess~"
	    ) {
    print("<li><a href=$url>$file</a></li>\n");
  }
}
closedir($dir);

print("</ul>\n");
print("</html>\n");
?>

